package com.study.mq.config;

import com.study.mq.domain.MessageDO;

import java.util.List;
import java.util.Map;

/**
 * @author ysy
 * @version 1.0
 * @Title: MessageHandler
 * @Note  消息接收工具类
 * <br><b>PackageName:</b> com.study.mq.rabbitMq.config
 * <br><b>ClassName:</b>
 * <br><b>Date:</b>
 */
public class MessageHandler {

    /**
     * @Author ysy
     * @Description 客户端发送JSON类型数据，但是没有指定消息的contentType类型，那么Jackson2JsonMessageConverter就会将消息转换成byte[]类型的消息进行消费
     * @Date 15:05 [message]
     * @Param
     * @return void
     **/
    public void onMessage(byte[] message){
        System.out.println("---------onMessage----byte-------------");
        System.out.println(new String(message));
    }


    public void onMessage(String message){
        System.out.println("---------onMessage---String-------------");
        System.out.println(message);
    }

    public void onMessage(Map message){
        System.out.println("---------onMessage---map-------------");
        System.out.println(message.toString());
    }

    public void onMessage(MessageDO message){
        System.out.println("---------onMessage---map-------------");
        System.out.println(message.toString());
    }

    public void onMessage(List message){
        System.out.println("---------onMessage---list-------------");
        System.out.println(message.toString());
    }
}
